package com.lemon.rpcframe.dao.contract;

import java.util.List;

import com.lemon.rpcframe.annotation.OperationContract;
import com.lemon.rpcframe.annotation.ServiceContract;
import com.lemon.rpcframe.dao.Total;
import com.lemon.rpcframe.dao.entity.TaskDefineBean;

@ServiceContract
public interface ITaskDefineService {

    @OperationContract
    public abstract long insert(TaskDefineBean entity) throws Exception;

    /**
     * 当执行完一任务时 通过jobid获取这个任务的详细信息
     * @param taskid
     * @return
     * @throws Exception
     */
    @OperationContract
    public abstract TaskDefineBean loadByJobID(long jobID) throws Exception;

    /**
     * 当执行完一任务时 通过jobid获取这个任务的详细信息
     * @param taskid
     * @return
     * @throws Exception
     */
    @OperationContract
    public abstract TaskDefineBean loadByTaskGroup(String taskID, String taskGroup) throws Exception;

    /**
     * 
     * @param taskid
     * @return
     * @throws Exception
     */
    @OperationContract
    public abstract int deleteByJobID(long jobID) throws Exception;

    /**
     * 查询任务定义   按日期倒排
     * @param taskid
     * @param start
     * @param ends
     * @param pageSize
     * @param page
     * @param total
     * @return
     * @order nexttriggerdate desc 
     * @throws Exception
     */
    @OperationContract
    public abstract List<TaskDefineBean> loadByPage(int pageSize, int page, Total<Integer> total) throws Exception;

    /**
     * 查询待执行的任务总量
     * @param taskid
     * @param start
     * @param end
     * @return
     * @throws Exception
     */
    @OperationContract
    public abstract int countAll() throws Exception;

}
